<template>
  <view class="receive-methods">
    <!-- 返回按钮和标题 -->
    <view class="header">
      <tn-button 
        backgroundColor="tn-bg-left" 
        style="color: black; position: absolute; left: 5%; top: 10%; width: 35px; height: 35px; font-size: 25px;" 
        :border="false"
        @click="handleReturn"
      >
        <text class="tn-icon-left"></text>
      </tn-button>
      <view class="page-title">收款方式</view>
    </view>

    <!-- 收款方式列表 -->
    <view class="receive-list">
      <tn-list-view 
        class="listView" 
        :card="true" 
        unlined="all" 
        @clickTitle="handleClickTitle" 
        :arrow="true"
      >
        <tn-list-cell 
          @click="selectReceiveMethod('支付宝')"
        >
          支付宝
        </tn-list-cell>
        <tn-list-cell 
          @click="selectReceiveMethod('微信')"
        >
          微信
        </tn-list-cell>
        <tn-list-cell 
          @click="selectReceiveMethod('银行卡')"
        >
          银行卡
        </tn-list-cell>
      </tn-list-view>
    </view>
  </view>
</template>

<script>
export default {
  methods: {
    // 返回上一页
    handleReturn() {
      uni.navigateBack({ delta: 1 });
    },
    // 点击标题事件处理
    handleClickTitle() {
      console.log("标题点击事件");
    },
    // 选择收款方式
    selectReceiveMethod(method) {
      console.log(`选择了收款方式: ${method}`);
      // 模拟跳转到具体的收款设置页面
      uni.showToast({
        title: `选择了${method}收款`,
        icon: 'success'
      });
      // 根据实际需求，可以跳转到具体的收款设置页面
      // uni.navigateTo({
      //   url: `/pages/receive/${method.toLowerCase()}`
      // });
    }
  }
};
</script>

<style scoped>
.receive-methods {
  padding: 20px;
  background-color: #f5f5f5; /* 轻微灰色背景 */
  height: 100%;
}

.header {
  position: relative;
  margin-top: 20px;
  padding-bottom: 30px;
  text-align: center;
  width: 100%;
}

.page-title {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  margin-top: 10px;
  color: #333;
  letter-spacing: 1px;
  font-family: "宋体", SimSun, sans-serif; /* 修改字体为宋体 */
}

.receive-list {
  margin-top: 40px;
}

.listView {
  margin-top: 20px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

tn-list-cell {
  padding: 15px 20px;
  font-size: 18px;
  color: #555;
  border-bottom: 1px solid #f1f1f1;
  font-family: "宋体", SimSun, sans-serif; /* 修改字体为宋体 */
}

tn-list-cell:last-child {
  border-bottom: none;
}

tn-list-cell:hover {
  background-color: #f0f0f0;
}

tn-list-cell:active {
  background-color: #e0e0e0;
}
</style>